import {defineStore} from 'pinia'
import {ref,computed} from 'vue'
// export const useCounterStore1 = defineStore('counter', {
//     state: () => {
//       return { count: 0 }
//     },
//     // 也可以这样定义
//     // state: () => ({ count: 0 })
//     actions: {
//       increment() {
//         this.count++
//       },
//     },
//   })
export const useCounterStore = defineStore('counter', () => {
     const count = ref(0)
    // function increment() {
    //   count.value++
    // }

    // return { count, increment }
    
    const name = ref("Edurardo");
    const isAdmin = ref(true);
    const increment = ()=>{
        count.value++;
    };
    const doubleCount = computed(()=>{
        return count.value * 2;
    });
    return {count,name,isAdmin,increment,doubleCount}
})